
"""
@This program will crate tag colud of he given data in file
"""
from pytagcloud import create_tag_image, make_tags, LAYOUT_HORIZONTAL, LAYOUT_MIX, LAYOUTS
from pytagcloud.lang.counter import get_tag_counts
import operator

so_data = open ("D:\Research\ISEC-2014\data\\tag_cloud_so_data.txt",'r')
su_data = open ("D:\Research\ISEC-2014\data\\tag_cloud_su_data.txt",'r')
meta_so_data = open ("D:\Research\ISEC-2014\data\\tag_cloud_meta_so_data.txt",'r')


so_text = ""
for l in so_data:
    so_text = so_text+" "+l
    

tags = (make_tags(sorted(get_tag_counts(so_text),key=operator.itemgetter(1),reverse=True),
               minsize=20,    maxsize=70))

print tags

create_tag_image(tags  , 'D:\\so.png', size=(900,600 ),      background=(255, 255, 255, 255),
                layout=LAYOUT_MIX, fontname='PT Sans Regular')


"""
su_text = ""
for l in su_data:
    su_text = su_text+" "+l
    

tags = (make_tags(sorted(get_tag_counts(su_text),key=operator.itemgetter(1),reverse=True),
               minsize=20,    maxsize=70))

print tags

create_tag_image(tags  , 'D:\\su.png', size=(900,600 ),      background=(255, 255, 255, 255),
                layout=LAYOUT_MIX, fontname='PT Sans Regular')


"""
"""
meta_so_text = ""
for l in meta_so_data:
    meta_so_text = meta_so_text+" "+l
    

tags = (make_tags(sorted(get_tag_counts(meta_so_text),key=operator.itemgetter(1),reverse=True),
               minsize=20,    maxsize=70))

print tags

create_tag_image(tags  , 'D:\\meta_so.png', size=(900,600 ),      background=(255, 255, 255, 255),
                layout=LAYOUT_MIX, fontname='PT Sans Regular')


"""